<?php
/**
 *
 */
namespace soa\account;

use soa\client;

/**
 * Class record
 */
class record extends client
{

    /**
     * 服务地址
     * @var string
     *
     */
    public $service_url = 'http://account.core.kuaidihelp.com/';

    /**
     * 服务名称
     * @var string
     */
    protected $service_name = 'kuaidihelp_account';


    /**
     * 获取查件记录
     * @param $user_id
     * @param $cut_time
     * @param $limit
     */
    public function getList($user_id, $cut_time, $limit,$type='all')
    {
        $data = [
            'user_id' => $user_id,
            'cut_time' => $cut_time,
            'limit' => $limit,
            'type' => $type
        ];
        return $this->get('v1/user/record/getList', $data);
    }


    /**
     * 修改查件记录备注
     * @param $user_id
     * @param $info 格式为 ：品牌-单号-remark-备注-end-,品牌-单号-remark-备注-end-
     */
    public function memoEdit($user_id, $info)
    {
        return $this->get('v1/user/record/memoEdit', array('user_id' => $user_id, 'info' => $info));
    }

    /**
     * @param $user_id
     * @param $deliverNo
     * @param $deliverCode
     * @return bool
     */
    public function brandEdit($user_id,$deliverNo,$deliverCode)
    {
        return $this->get('v1/user/record/brandEdit', array('user_id' => $user_id, 'deliverNo' => $deliverNo,'deliverCode'=>$deliverCode));
    }


    /**
     * 删除用户查件记录
     * @param $user_id
     * @param $info
     * @return bool|null|array
     */
    public function delete($user_id, $imei = '', $type = '', $info)
    {
        return $this->get('v1/user/record/delete', compact('user_id', 'imei', 'type', 'info'));
    }

    /**
     * 回填单号时添加查件记录
     * @return bool|null
     */
    public function addRecordByWaybillNo($shipper_uid, $waybill_no, $brand)
    {
        return $this->get('v1/user/record/addRecordByWaybillNo', compact('shipper_uid', 'waybill_no', 'brand'));
    }

    /**
     * account_user 委托
     * @param $method
     * @param $args
     * @return bool|null
     */
    public function __call($method, $args)
    {
        return $this->get("v1/user/record/{$method}", $args[0]);
    }

    /**
     * 查询
     * @param $user_id
     * @param $waybill_no
     * @param $brand
     * @return array
     */
    public function getInfo($user_id,$waybill_no,$brand){
        return $this->get('v1/user/record/getInfo', compact('user_id', 'waybill_no', 'brand'));
    }
}
